package suanfarumen;

import org.junit.Test;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;

public class day11_3 {
    public static List<String> letterCasePermutation(String s) {
        List<StringBuilder> target =new ArrayList<>();
        target.add(new StringBuilder());
        for (char c:s.toCharArray()){
            int n=target.size();
            if (Character.isLetter(c)){
                for (int i=0;i<n;++i){
                    target.add(new StringBuilder(target.get(i)));
                    target.get(i).append(Character.toLowerCase(c));
                    target.get(n+i).append(Character.toUpperCase(c));
                }
            }else{
                for (int i=0;i<n;++i){
                    target.get(i).append(c);
                }
            }
        }
        List<String> finalTarget =new ArrayList<>();

        for(StringBuilder sb:target){
            finalTarget.add(sb.toString());
        }
        return finalTarget;
    }



    @Test
    public void test(){
    System.out.println(letterCasePermutation("G2b1"));
}

}
